Skip to content

Optimize performance and enhance security with automated release workflow#386

Open
aa51513 wants to merge 2 commits intodswd:masterfrom
aa51513:master
Open

Optimize performance and enhance security with automated release workflow#386
aa51513 wants to merge 2 commits intodswd:masterfrom
aa51513:master

Conversation

@aa51513
Copy link

@aa51513 aa51513 commented Mar 20, 2026

No description provided.

aa51513 added 2 commits March 20, 2026 20:32
Performance Improvements:

Implement radix trie for CIDR-based routing table lookups (O(n) → O(prefix_len))
Optimize traffic statistics hot path using get_mut() fast path
Replace Cursor with direct array indexing in packet parsing
Use heap allocation for MsgBuffer to reduce stack pressure (64KB → 32 bytes on stack)
Security Enhancements:

Increase PBKDF2 iterations from 4,096 to 600,000 (OWASP recommendation)
Add input validation for init messages to prevent DoS attacks (max 64KB field length)
Code Quality:

Add documentation for magic numbers (ROTATE_INTERVAL, NONCE_LEN, MAX_FAILED_RETRIES)
Improve error handling by replacing unwrap() with proper error propagation in GenericCloud::new
Files Modified:

src/table.rs: Implement ClaimTrie for O(prefix_len) lookups
src/traffic.rs: Optimize hot path performance
src/payload.rs: Direct array indexing for faster parsing
src/util.rs: Heap-allocate MsgBuffer buffer
src/crypto/common.rs: Increase PBKDF2 iterations
src/crypto/init.rs: Add input validation and documentation
src/cloud.rs: Improve error handling
src/main.rs: Adapt to new error handling interface
All changes maintain backward compatibility and existing functionality.
Changes:

Add .github/workflows/release.yml for automated releases triggered by v* tags
Support optional GPG signing - skip gracefully when GPG_PRIVATE_KEY is not configured
Support optional crates.io publishing - skip when CARGO_REGISTRY_TOKEN is not configured
Supported architectures:

Packages: amd64.deb, i386.deb, arm64.deb, armhf.deb, armel.deb, x86_64.rpm, i686.rpm
Static binaries: static_amd64, static_i386, static_arm64, static_armhf, static_armel
How to trigger:

git tag v1.2.3
git push origin v1.2.3
GitHub Secrets configuration:

Secret Required Description
GITHUB_TOKEN Auto Automatically provided by GitHub
GPG_PRIVATE_KEY Optional GPG private key for signing (skip if not set)
GPG_PASSPHRASE Optional GPG key passphrase
CARGO_REGISTRY_TOKEN Optional crates.io API token (skip publish if not set)
Generate GPG key (if needed):

gpg --full-generate-key
gpg --list-secret-keys --keyid-format=long
gpg --armor --export-secret-keys YOUR_KEY_ID
@dswd
Copy link
Owner

dswd commented Mar 20, 2026

Thanks for the PR. I will have to run the numbers to see what the actual performance increase is but it looks like it can't hurt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants